<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">

      google.load("visualization", "1.0", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);

      function drawChart() {
        /* Creating a data table from an array that is previously formatted.
        Data array is created by the ProcSnapshot class and formatted as such:
        [Process type/PID/General, value].
        Title consists of snapshot's timestamp and memory type being graphed
        (i.e. RSS, PSS, private, shared, etc.)
        */
        var data = google.visualization.arrayToDataTable(%(data)s);
        var options = {title:"%(title)s"};

        var cdiv = document.getElementById('chart_div');
        var chart = new google.visualization.PieChart(cdiv);
        chart.draw(data, options);
      }
    </script>
  </head>

  <body>
    <p> Percentage of memory consumed by each process/memtype per snapshot </p>
    <p> Snapshot taken at %(timestamp)s </p>
    <div id="chart_div" style="width: 1200px; height: 800px;"></div>
    <p> System information: %(version)s </p>
  </body>
</html>
